<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta http-equiv="X-UA-Compatible" content="ie=edge">
  <title>Document</title>
</head>

<body>
  <script>
    const str = '黑马程序员'
    console.log(encodeURI(str));//%E9%BB%91%E9%A9%AC%E7%A8%8B%E5%BA%8F%E5%91%98
    console.log(decodeURI('%E9%BB%91%E9%A9%AC%E7%A8%8B%E5%BA%8F%E5%91%98'));
    console.log(encodeURIComponent('红&&黑'));
    console.log(decodeURIComponent('红&&黑'));
  </script>
</body>

</html>